#!/bin/bash
#
# Program name: script.sh
#
# -----------------------------------
#   
#   A program that take as input a linux
#   distro and install my dev. enviroment
#   including NVIM, LF, GIT, NODE, and NPM
#
#   Obs.: the idea is to i be able to install
#     fast my base enviroment, nothing more
#     as the KISS philosophy says <3
#
# -----------------------------------
#
# Versions:
#
# 1.0: suport to arch linux
# 2.0: suport to debian

#####################################
#
#   the 1TH SECTION of the script
#   handles with the parameters
#   of the script, nothing more
#
#####################################
# help MSG
HELP_MESSAGE="
  wellcome to "$0"

  Parameters:

    -h, --help: help message (this one :P)
    -v, --version: show the version of the software
"

# compute of the parameters
case "$1" in
  -h | --help)
    echo "$HELP_MESSAGE"
    exit 0
  ;;

  -v | --version)
    echo "$0" 2.0
    exit 0
  ;;

  *)
    if test -n "$1"
    then
      echo "$1" is not a valid option of "$0"
      exit 1
    fi
esac

#####################################
#
#   the 2TH SECTION of the script
#   handles with the functions
#   of the script, nothing more
#
#####################################

arch_script()
{
  sudo pacman -Syuu --noconfirm

  echo INSTALING: nvim, kitty, neofetch, lf, git, npm, node
  sudo pacman -S neovim kitty neofetch lf git node npm --noconfirm

  # config file
  echo CREATING THE .CONFIG FILE
  mkdir ~/.config
  cd ~/.config

  # nvim config
  echo NVIM CONFIGURATION
  git clone https://gitlab.com/personal6085541/nvim_config

  mv nvim_config ~/.config/
  mv ~/.config/nvim_config ~/.config/nvim

  echo INSTALLING PACKER
  git clone --depth 1 https://github.com/wbthomason/packer.nvim\
   ~/.local/share/nvim/site/pack/packer/start/packer.nvim

  # lf config
  echo LF CONFIGURATION
  git clone https://gitlab.com/personal6085541/lf_config

  mv lf_config ~/.config
  mv ~/.config/lf_config ~/.config/lf

  echo FINISH INSTALATION
  neofetch
}

debian_script()
{
  sudo pacman -Syuu --noconfirm

  echo INSTALING: nvim, kitty, neofetch, lf, git, npm, node
  sudo pacman -S neovim kitty neofetch lf git node npm --noconfirm

  # config file
  echo CREATING THE .CONFIG FILE
  mkdir ~/.config
  cd ~/.config

  # nvim config
  echo NVIM CONFIGURATION
  git clone https://gitlab.com/personal6085541/nvim_config

  mv nvim_config ~/.config/
  mv ~/.config/nvim_config ~/.config/nvim

  echo INSTALLING PACKER
  git clone --depth 1 https://github.com/wbthomason/packer.nvim\
   ~/.local/share/nvim/site/pack/packer/start/packer.nvim

  # lf config
  echo LF CONFIGURATION
  git clone https://gitlab.com/personal6085541/lf_config

  mv lf_config ~/.config
  mv ~/.config/lf_config ~/.config/lf

  echo FINISH INSTALATION
  neofetch
}

#####################################
#
#   the 3TH SECTION of the script
#   handles with the script and instalations
#   of the script, nothing more
#
#####################################
# input
echo "
  choose a option of distro:

  d (debian)
  a (arch)
  ...
"
read option

# computing
case "$option" in
  a | arch | Arch)
    echo INSTALING ON A ARCH DISTRO
    arch_script
  ;;
esac
